import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import javax.swing.JLabel;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.ScrollPane;
import javax.swing.JTextPane;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.JButton;
import javax.swing.SpringLayout;
import javax.swing.SwingConstants;


public class ThunderDragonFrame extends JPanel {
	private JTextPane textField;

	JPanel panel = new JPanel();
	
	ScrollPane scrollPaneMenu = new ScrollPane();
	
	ScrollPane scrollPaneMain = new ScrollPane();
	
	HomePanel home = new HomePanel();
	
	private final JButton btnLogout = new JButton("Log out");
	
	private class LogoutListen implements ActionListener{

		@Override
		public void actionPerformed(ActionEvent arg0) {
			setVisible(false);
		}
		
		public String toString(){
			return "A string for the logoutListener";
		}
		
	}

	public ThunderDragonFrame() {
		setLayout(new BorderLayout(0, 0));
		setPreferredSize(new Dimension(700, 600));
		
		add(panel, BorderLayout.NORTH);
		panel.setPreferredSize(new Dimension(700, 60));
		SpringLayout panelLayout = new SpringLayout();
		panelLayout.putConstraint(SpringLayout.EAST,
				btnLogout, -10, SpringLayout.EAST, panel);
		panel.setLayout(panelLayout);
		
		textField = new JTextPane();
		panelLayout.putConstraint(SpringLayout.SOUTH,
				btnLogout, -12, SpringLayout.SOUTH, textField);
		panelLayout.putConstraint(SpringLayout.EAST, 
				textField, -39, SpringLayout.WEST, btnLogout);
		panelLayout.putConstraint(SpringLayout.NORTH,
				textField, 10, SpringLayout.NORTH, panel);
		textField.setFont(new Font("Pristina", Font.BOLD | Font.ITALIC, 32));
		textField.setText("Thunder Dragon Hospital System");
		textField.setBackground(SystemColor.control);
		textField.setEditable(false);
		panel.add(textField);
		
		panel.add(btnLogout);
		btnLogout.addActionListener(new LogoutListen());
		
		scrollPaneMenu.setPreferredSize(new Dimension(150, 500));
		scrollPaneMenu.setMinimumSize(new Dimension(150, 500));
		add(scrollPaneMenu, BorderLayout.WEST);
		scrollPaneMain.setPreferredSize(new Dimension(350, 400));
		scrollPaneMain.setMinimumSize(new Dimension(350, 400));
		scrollPaneMain.add(home);
		add(scrollPaneMain, BorderLayout.CENTER);
		
	}

	@Override
	public String toString() {
		return "ThunderDragonFrame [textField=" + textField + ", panel="
				+ panel + ", scrollPaneMenu=" + scrollPaneMenu
				+ ", scrollPaneMain=" + scrollPaneMain + ", home=" + home
				+ ", btnLogout=" + btnLogout + "]";
	}
	

}
